<?php


/**
 * Notes:
 * PROJECT_NAME : ERP v1.8 重构erp
 * User: 夏鱼儿<397072174@qq.com>
 * Date: 2024/4/26
 * Time: 17:04
 */

namespace app\mini\model;

use app\service\base\Model;

/**
 * @method static user($store_user_Id)
 * @method static salesman($store_user_Id)
 * @method static orderStatus($store_user_Id)
 */
class Base extends Model
{
    public function scopeUser($query, $store_user_Id)
    {
        return $query->where('store_user_Id', $store_user_Id);
    }

    public function scopeSalesman($query, $store_user_Id)
    {
        return $query->where('salesman_id', $store_user_Id);
    }

    public function scopeOrderStatus($query, $order_status = 0)
    {
        // 订单状态 1待付款 2待发货 3待收货 4已完成 5已取消
        if ($order_status) {
            return $query->where('order_status', $order_status);
        } else {
            return $query;
        }
    }
}